Release 10.1A: OpenEdge Development:
Programming Interfaces
Reporting information from multiple tables
Each order has one or many order lines, each of which relates to a single inventory item. Accounting needs to pull information from the Order-Line and Item tables to get specific information about what was ordered. One more
FOREACHblock, inside the existing block, completes the structure.Once the procedure gathers all the information, accounting needs the procedure to calculate total prices. Nested
FOREACHblocks create sorted groups of information similar to break groups. Therefore, you can use the aggregate phrase to calculate total prices.This code fragment comes from
i-10-08.pand shows the completed structure of nestedFOREACHblocks:
These notes explain the code highlights:
- The
WHEREclause of the thirdFOREACHrelates the Order-Line table back to the Order table.- For each Order-Line, there is a single Item record that contains information about the ordered item. A simple
FINDstatement retrieves this information.- Here, the report totals the result of an expression. Notice the absence of the
BYbreak group syntax.- The
FORMAToption here specifies a fairly complex format string. The result displays a leading dollar sign ($), suppresses the leading zeroes (z), and displays the credit symbol (CR) when the result is a negative value.The output of the final version of this report follows:
![]()
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |